package com.explodingzombie.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class RssParser {

	public static List<RssItem> parse(InputStream inStream, RssHandler handler)
		throws IOException
	{
		SAXParserFactory saxFactory = SAXParserFactory.newInstance();
		try{
			SAXParser parser = saxFactory.newSAXParser();
			parser.parse(inStream, handler);
			return handler.getItems();
		}catch(IOException ioe){
			throw ioe;
		}catch(Exception e){
			e.printStackTrace();
			throw new RuntimeException(e);
		}
	}	
	
}
